<style>
    #itemCreateCode-update {
        padding: 20px 25px 25px 0;
    }

    .layui-form-label {
        width: 140px;
    }

    .layui-input-block {
        margin-left: 170px;
    }

    .layui-layer-page .layui-layer-content {
        overflow: visible !important;
    }
</style>
<div class="layui-fluid" id="itemCreateCode-update">
    <form class="layui-form" action="" lay-filter="itemCreateCode-update-form">
        <div class="layui-form-item">
            <div class="layui-row">
                <div class="layui-col-md6">
                    <label class="layui-form-label website-form-item-require">年份：</label>
                    <div class="layui-input-block">
                        <select name="typeCode" lay-verify="required" lay-filter="topicList">
                            <option value="">请选择</option>
                            <option
                                    th:each="item : ${topicList}"
                                    th:value="${item.year}" th:text="${item.year}">
                            </option>
                        </select>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-form-item website-hide">
            <button class="layui-btn" lay-submit="" lay-filter="item-create-code-form-submit" id="submit"></button>
            <button type="reset" class="layui-btn" id="reset"></button>
        </div>
    </form>
</div>

<script data-th-inline="javascript">
    layui.use(['website', 'form', 'validate', 'dict'], function () {
        var $ = layui.$,
            website = layui.website,
            form = layui.form,
            validate = layui.validate;
        form.verify(validate);
        form.render();

        form.on('submit(item-create-code-form-submit)', function (data) {
            website.modal.confirm('生成编码', '生成立项编码后不允许进行任何修改，是否要生成？', function () {
                website.post(ctx + 'biz/item/createCode/' + data.field.typeCode, null, function () {
                    layer.closeAll();
                    website.alert.success('生成立项编码成功！');
                    $('#website-item').find('#query').click();
                });
            });
            return false;
        });
    });
</script>